unit unitLogin;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, System.Generics.Collections;

type
  TfrmLogin = class(TForm)
    dlgOpenAcc: TOpenDialog;
    pgc1: TPageControl;
    tsAcc: TTabSheet;
    tsAce: TTabSheet;
    tsSql: TTabSheet;
    lbl1: TLabel;
    btnBrowserAccFile: TButton;
    edtAccFile: TEdit;
    lbl2: TLabel;
    edtAccPrefix: TEdit;
    btnAccOK: TButton;
    btnAccCancel: TButton;
    lbl3: TLabel;
    btnBrowseAceFile: TButton;
    edtAceFile: TEdit;
    lbl4: TLabel;
    edtAcePrefix: TEdit;
    btnAceOK: TButton;
    btnAceCancel: TButton;
    dlgOpenAce: TOpenDialog;
    lbl5: TLabel;
    edtSqlHost: TEdit;
    lbl6: TLabel;
    edtSqlPort: TEdit;
    lbl7: TLabel;
    edtSqlUser: TEdit;
    lbl8: TLabel;
    edtSqlPassword: TEdit;
    lbl9: TLabel;
    edtSqlCatalog: TEdit;
    lbl10: TLabel;
    edtSqlSchema: TEdit;
    btnSqlOK: TButton;
    btnSqlCancel: TButton;
    lbl11: TLabel;
    edtSqlPrefix: TEdit;
    procedure btnBrowserAccFileClick(Sender: TObject);
    procedure btnBrowseAceFileClick(Sender: TObject);
    procedure btnAccOKClick(Sender: TObject);
    procedure btnAceOKClick(Sender: TObject);
    procedure btnSqlOKClick(Sender: TObject);
  private
    { Private declarations }
    FConnectionInfo:TDictionary<string,string>;
  public
    { Public declarations }
    constructor Create(AOwner: TComponent);override;
    property ConnectionInfo:TDictionary<string,string> read FConnectionInfo;
  end;


var
  frmLogin: TfrmLogin;

implementation

{$R *.dfm}

constructor TfrmLogin.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  self.FConnectionInfo:=TDictionary<string,string>.Create;
end;

procedure TfrmLogin.btnAccOKClick(Sender: TObject);
begin
  FConnectionInfo.Clear;
  FConnectionInfo.Add('dbname','Access 97-2003');
  FConnectionInfo.Add('dbtype','acc');
  FConnectionInfo.Add('file',edtAccFile.Text);
  FConnectionInfo.Add('prefix',edtAccPrefix.Text);
end;

procedure TfrmLogin.btnAceOKClick(Sender: TObject);
begin
  FConnectionInfo.Clear;
  FConnectionInfo.Add('dbname','Access 2007-2013');
  FConnectionInfo.Add('dbtype','ace');
  FConnectionInfo.Add('file',edtAceFile.Text);
  FConnectionInfo.Add('prefix',edtAcePrefix.Text);
end;

procedure TfrmLogin.btnSqlOKClick(Sender: TObject);
begin
  FConnectionInfo.Clear;
  FConnectionInfo.Add('dbname','Microsoft SQL Server');
  FConnectionInfo.Add('dbtype','sql');
  FConnectionInfo.Add('host',edtSqlHost.Text);
  FConnectionInfo.Add('port',edtSqlPort.Text);
  FConnectionInfo.Add('username',edtSqlUser.Text);
  FConnectionInfo.Add('password',edtSqlPassword.Text);
  FConnectionInfo.Add('catalog',edtSqlCatalog.Text);
  FConnectionInfo.Add('schema',edtSqlSchema.Text);
  FConnectionInfo.Add('prefix',edtSqlPrefix.Text);
end;

procedure TfrmLogin.btnBrowseAceFileClick(Sender: TObject);
begin
  if(dlgOpenAce.Execute(self.Handle)) then begin
    edtAceFile.Text:=dlgOpenAce.FileName;
  end;
end;

procedure TfrmLogin.btnBrowserAccFileClick(Sender: TObject);
begin
  if(dlgOpenAcc.Execute(self.Handle)) then begin
    edtAccFile.Text:=dlgOpenAcc.FileName;
  end;
end;

end.
